package com.finalterm.product.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 库存操作记录
 */
@Data
@TableName("stock_records")
public class StockRecord {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    /**
     * 商品ID
     */
    private Long productId;
    
    /**
     * 订单ID
     */
    private String orderId;
    
    /**
     * 操作类型：DEDUCT-扣减，RECOVER-恢复，CONFIRM-确认
     */
    private String operationType;
    
    /**
     * 操作数量
     */
    private Integer quantity;
    
    /**
     * 操作前库存
     */
    private Integer beforeStock;
    
    /**
     * 操作后库存
     */
    private Integer afterStock;
    
    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 逻辑删除：0-未删除，1-已删除
     */
    @TableLogic
    private Integer deleted;
}
